//---------------------------------------------------------------------------+
// Copyright (C), 1998-2011, Beijing Tangent Software Co. Ltd.
// = FileName	:   TDbWall.h
// = Version	:   ver1.0
// = Author		:   wlw,gjm
// = CreateDate	:   2011-04-19
// = Description:   TDbWall 
// = Maintainers: 
//---------------------------------------------------------------------------+

#ifndef __TDBWALL_H__
#define __TDBWALL_H__

#include "TDbEntity.h"

struct OpenProperty
{
	AcGePoint3d ptIns;
	CString sType;
	double dL;	
	double dT;
	double dH;
};

class TARCH_API TDbWall : public  TDbEntity
{
	TGRX_DECLARE_MEMBERS(TDbWall)
public:
	TDbWall() {};
	virtual ~TDbWall(){}
	
	virtual void WorldDraw(TGiWorldDraw& dc) const;
	virtual TENTTYPE Type(){return TGlobalDec::eWall;}

	void SortOpens(std::vector<OpenProperty>& vtOpens, AcGeLine3d *pLine) const;
};

struct SortOpen: public std::binary_function<OpenProperty, OpenProperty, bool>
{
	AcGeLine3d *pLine;
	SortOpen(AcGeLine3d *p): pLine(p){}
	bool operator () (OpenProperty &o1, OpenProperty &o2)
	{
		AcGePoint3d ptGe1 = o1.ptIns;
		AcGePoint3d ptGe2 = o2.ptIns;
		double dDis1 = 0.0,dDis2 = 0.0;
		dDis1 = pLine->paramOf(ptGe1);
		dDis2 = pLine->paramOf(ptGe2);
		return DOWN_ZERO(dDis1 - dDis2);
	}
};
#endif	//__TDBWALL_H__